<?php
// src/Pyaf/GymBundle/Entity/PersonaRepository.php
namespace Pyaf\GymBundle\Entity;

use Doctrine\ORM\EntityRepository;

/**
 * Description of PersonaRepository
 *
 * @author Toshiba P755-S5272
 */
class PersonaRepository extends EntityRepository{
    
    /**
     *  
     * @return a list of Personas order by name
     */
    public function findAllOrderByNombre() {        
        return $this->getEntityManager()
                ->createQuery('SELECT p FROM PyafGymBundle:Persona p ORDER BY p.apellido ASC')                
                ->getResult();
    }
    
    public function save($persona){
        $this->savePersona($persona);
    }
    
    public function savePersona($persona) {
        $em = $this->getEntityManager();
        $em->persist($persona);
        $em->flush();
    }
    
}

?>
